<?php
/**
 * セッション情報登録APIモデル<br />
 *
 * セッション情報登録APIモデル
 *
 * @package apamanshop
 * @author shibutani-y@systemsoft.co.jp
 * @copyright コピーライト(要確認)
 */
class Inquiry_Model_Apiinquiry extends Inquiry_Model_Apibase{

	// ASお問い合わせ
	public function insInqUserLog($db,$params,$add_params) {

		$strQry = "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$strQry .= "W25_TOIAWASE_ID, ";
		$strQry .= "W25_KENSAKU_FLAG, ";
		$strQry .= "W25_GENRU_FLAG, ";
		$strQry .= "W25_DATE, ";
		$strQry .= "W25_NAME, ";
		$strQry .= "W25_NAME_KANA, ";// 20141211 Add
		$strQry .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$strQry .= "W25_MAIL, ";
		$strQry .= "W25_TEL, ";
		$strQry .= "W25_FAX, ";
		$strQry .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SHUBETSU, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
		$strQry .= "W25_MAIL_MAGAZINE_NEED_FLAG, ";
		$strQry .= "W25_SEARCH_KUBUN, ";
		$strQry .= "W25_USER_ACT_KUBUN, ";
		$strQry .= "W25_OEM_CD, ";
		$strQry .= "W25_DELETE_FLAG, ";
		$strQry .= "W25_COMPANY_NAME ) ";
		$strQry .= "VALUES ";
		$strQry .= "( ";
		$strQry .= $add_params['InqNo'] . ", ";
		$strQry .= "0, ";
		$strQry .= $add_params['ComGenruFlg'] . ", ";
		$strQry .= "SYSDATE, ";
		$strQry .= "'" . $params['NameSei'] . "　" . $params['NameMei'] . "', ";
		$strQry .= "'" . $params['NameSeiKana'] . "　" . $params['NameMeiKana'] . "', ";// 20141211 Add
		$strQry .= "'" . $params['CntctWayCd'] . "', ";
		$strQry .= "'" . $params['Mail'] . "', ";
		$strQry .= "'" . $params['Tel']  . "', ";
		$strQry .= "'" . $params['Fax']  . "', ";
		$strQry .= "'" . $params['NeedTimeKbn'] . "', ";
		$strQry .= "'', ";
		$strQry .= "'" . $params['Comment'] . "', ";
		$strQry .= "'', ";
		$strQry .= "'" . $params['SrhKbn'] ."', ";
		$strQry .= "'', ";
		$strQry .= "'', ";
		$strQry .= "0, ";
		$strQry .= "'" . $params['Name'] . "')";
__log_debug(__FILE__, __LINE__, __METHOD__, "★★★★★★★★W25TOIAWASE_USER_LOG★★★★★★★★");
__log_debug_array(__FILE__, __LINE__, __METHOD__, $params);
__log_debug(__FILE__, __LINE__, __METHOD__, $strQry);
		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W25TOIAWASE_USER_LOG");
		return $resArr;
	}

	// 店舗お問い合わせ
	public function insInqUserLog2($db,$params,$add_params) {

		$strQry  = "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$strQry .= "W25_TOIAWASE_ID, ";
		$strQry .= "W25_KENSAKU_FLAG, ";
		$strQry .= "W25_GENRU_FLAG, ";
		$strQry .= "W25_DATE, ";
		$strQry .= "W25_NAME, ";
		$strQry .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$strQry .= "W25_MAIL, ";
		$strQry .= "W25_TEL, ";
		$strQry .= "W25_FAX, ";
		$strQry .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
		$strQry .= "W25_MAIL_MAGAZINE_NEED_FLAG, ";
		$strQry .= "W25_TOIAWASE_NAIYOU, ";
		$strQry .= "W25_ROOT_KUBUN, ";
		$strQry .= "W25_ROOT_ALL,";
		$strQry .= "W25_NAME_KANA";// 20141211 Add
		$strQry .= " )";
		$strQry .= "VALUES ";
		$strQry .= "( ";
		$strQry .= " :InqNo ,";
		$strQry .= "2, ";
		$strQry .= " :ComGenruFlg ,";
		$strQry .= "SYSDATE, ";
		$strQry .= " :Name , ";
		$strQry .= " :CntctWayCd ,";
		$strQry .= " :Mail ,";
		$strQry .= " :Tel ,";
		$strQry .= " :Fax ,";
		$strQry .= " :NeedTimeKbn ,";
		$strQry .= " :strComment ,";
		$strQry .= " :MailMgznFlg ,";
		$strQry .= " :InquiryFlg ,";
		$strQry .= " :LpCampaignCd ,";
		$strQry .= " :LpRootCd ,";
		$strQry .= " :NameKana ";// 20141211 Add
		$strQry .= ")";

		$db_params['InqNo']        = $add_params["InqNo"];
		$db_params['ComGenruFlg']  = $add_params["ComGenruFlg"];
		$db_params['Name']         = $add_params["Name"];
		$db_params['NameKana']     = $add_params["NameKana"];// 20141211 Add
		$db_params['CntctWayCd']   = $params["CntctWayCd"];
		$db_params['Mail']         = $params["Mail"];
		$db_params['Tel']          = $params["Tel"];
		$db_params['Fax']          = $params["Fax"];
		$db_params['NeedTimeKbn']  = $params["NeedTimeKbn"];
		$db_params['strComment']   = $params["Comment"].$add_params['RaitenTxt'];
		$db_params['MailMgznFlg']  = $params["MailMgznFlg"];
		$db_params['InquiryFlg']   = $add_params['InquiryFlg'];

		$db_params['LpCampaignCd'] = $params["LpCampaignCd"];
		$db_params['LpRootCd']     = $params["LpRootCd"];

		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W25TOIAWASE_USER_LOG");
		return $resArr;
	}

	//物件リクエストお問い合わせ
	public function insInqUserLog3($db,$params,$add_params) {
		$db_params = array();

		$strQry  = "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$strQry .= "W25_TOIAWASE_ID, ";
		$strQry .= "W25_KENSAKU_FLAG, ";
		$strQry .= "W25_GENRU_FLAG, ";
		$strQry .= "W25_DATE, ";
		$strQry .= "W25_NAME, ";
		$strQry .= "W25_NAME_KANA, ";// 20141211 Add
		$strQry .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$strQry .= "W25_MAIL, ";
		$strQry .= "W25_TEL, ";
		$strQry .= "W25_FAX, ";
		$strQry .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
		$strQry .= "W25_SEARCH_KUBUN, ";
		$strQry .= "W25_COMPANY_NAME, ";
		$strQry .= "W25_ROOT_KUBUN, ";
		$strQry .= "W25_ROOT_ALL ";
		$strQry .= " )";
		$strQry .= "VALUES ";
		$strQry .= "( ";
		$strQry .= " :InqNo ,";
		$strQry .= "1, ";
		$strQry .= " :ComGenruFlg ,";
		$strQry .= "SYSDATE, ";
		$strQry .= " :Name , ";
		$strQry .= " :NameKana , ";// 20141211 Add
		$strQry .= " :CntctWayCd ,";
		$strQry .= " :Mail ,";
		$strQry .= " :Tel ,";
		$strQry .= " :Fax ,";
		$strQry .= " :NeedTimeKbn ,";
		$strQry .= " :strComment ,";
		$strQry .= " :SrhKbn ,";
		$strQry .= " :UserComName ,";
		$strQry .= " :LpCampaignCd ,";
		$strQry .= " :LpRootCd ";
		$strQry .= ")";

		$db_params['InqNo']        = $add_params["InqNo"];
		$db_params['ComGenruFlg']  = $add_params["ComGenruFlg"];
		$db_params['Name']         = $params['NameSei'] . "　" . $params['NameMei'];
		$db_params['NameKana']         = $params['NameSeiKana'] . "　" . $params['NameMeiKana'];// 20141211 Add
		$db_params['CntctWayCd']   = $params["CntctWayCd"];
		$db_params['Mail']         = $params["Mail"];
		$db_params['Tel']          = $params["Tel"];
		$db_params['Fax']          = $params["Fax"];
		$db_params['NeedTimeKbn']  = $params["NeedTimeKbn"];
		$db_params['strComment']   = $params["Comment"];
		$db_params['SrhKbn']       = $params["SrhKbn"];
		$db_params['UserComName']  = $params["UserComName"];

		$db_params['LpCampaignCd'] = $params["LpCampaignCd"];
		$db_params['LpRootCd']     = $params["LpRootCd"];

		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W25TOIAWASE_USER_LOG");
		return $resArr;
	}

	// 20141212 S_Add
	// 建物お問い合わせ
	public function insInqUserLog4($db,$params,$add_params) {
	
		$strQry  = "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$strQry .= "W25_TOIAWASE_ID, ";
		$strQry .= "W25_KENSAKU_FLAG, ";
		$strQry .= "W25_GENRU_FLAG, ";
		$strQry .= "W25_DATE, ";
		$strQry .= "W25_NAME, ";
		$strQry .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$strQry .= "W25_MAIL, ";
		$strQry .= "W25_TEL, ";
		$strQry .= "W25_FAX, ";
// 		$strQry .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
// 		$strQry .= "W25_MAIL_MAGAZINE_NEED_FLAG, ";
		$strQry .= "W25_TOIAWASE_NAIYOU, ";
		$strQry .= "W25_ROOT_KUBUN, ";
		$strQry .= "W25_ROOT_ALL,";
		$strQry .= "W25_NAME_KANA";// 20141211 Add
		$strQry .= " )";
		$strQry .= "VALUES ";
		$strQry .= "( ";
		$strQry .= " :InqNo ,";
		$strQry .= "3, ";
		$strQry .= " :ComGenruFlg ,";
		$strQry .= "SYSDATE, ";
		$strQry .= " :Name , ";
		$strQry .= " :CntctWayCd ,";
		$strQry .= " :Mail ,";
		$strQry .= " :Tel ,";
		$strQry .= " :Fax ,";
// 		$strQry .= $this->convertDBValue($params["NeedTimeKbn"],1) . ",";
		$strQry .= " :strComment ,";
// 		$strQry .= $this->convertDBValue($params["MailMgznFlg"],1) . ",";
		$strQry .= " :InquiryFlg ,";
		$strQry .= " :LpCampaignCd ,";
		$strQry .= " :LpRootCd , ";
		$strQry .= " :NameKana ";
		$strQry .= ")";
		
		// 20150219 S_Add
		$db_params['InqNo']        = $add_params["InqNo"];
		$db_params['ComGenruFlg']  = $add_params["ComGenruFlg"];
		$db_params['Name']         = $add_params["Name"];
		$db_params['NameKana']     = $add_params["NameKana"];
		$db_params['CntctWayCd']   = $add_params["CntctWayCd"];
		$db_params['Mail']         = $params["Mail"];
		$db_params['Tel']          = $params["Tel"];
		$db_params['Fax']          = $params["Fax"];
// 		$db_params['NeedTimeKbn']  = $params["NeedTimeKbn"];
		$db_params['strComment']   = $params["Comment"];
// 		$db_params['MailMgznFlg']   = $params["MailMgznFlg"];
		$db_params['InquiryFlg']   = $params["InquiryFlg"];
// 		$db_params['SrhKbn']       = $params["SrhKbn"];
// 		$db_params['UserComName']  = $params["UserComName"];
		
		$db_params['LpCampaignCd'] = $params["LpCampaignCd"];
		$db_params['LpRootCd']     = $params["LpRootCd"];
		// 20150219 E_Add
		
		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W25TOIAWASE_USER_LOG");
		return $resArr;
	}
	// 20141212 E_Add
	
	// 20141222 S_Add
	// 検索条件のお問い合わせ
	public function insInqUserLog5($db,$params,$add_params) {
	
		$strQry  = "INSERT INTO W25TOIAWASE_USER_LOG( ";
		$strQry .= "W25_TOIAWASE_ID, ";
		$strQry .= "W25_KENSAKU_FLAG, ";
		$strQry .= "W25_GENRU_FLAG, ";
		$strQry .= "W25_DATE, ";
		$strQry .= "W25_NAME, ";
		$strQry .= "W25_KIBOU_RENRAKU_SHUDAN, ";
		$strQry .= "W25_MAIL, ";
		$strQry .= "W25_TEL, ";
		$strQry .= "W25_FAX, ";
// 		$strQry .= "W25_KIBOU_RENRAKU_ZIKAN, ";
		$strQry .= "W25_TOIAWASE_NAIYOU_SONOTA, ";
// 		$strQry .= "W25_MAIL_MAGAZINE_NEED_FLAG, ";
		$strQry .= "W25_TOIAWASE_NAIYOU, ";
		$strQry .= "W25_ROOT_KUBUN, ";
		$strQry .= "W25_ROOT_ALL,";
		$strQry .= "W25_NAME_KANA";// 20141211 Add
		$strQry .= " )";
		$strQry .= "VALUES ";
		$strQry .= "( ";
		$strQry .= " :InqNo ,";
		$strQry .= "1, ";
		$strQry .= " :ComGenruFlg ,";
		$strQry .= "SYSDATE, ";
		$strQry .= " :Name , ";
		$strQry .= " :CntctWayCd ,";
		$strQry .= " :Mail ,";
		$strQry .= " :Tel ,";
		$strQry .= " :Fax ,";
// 		$strQry .= $this->convertDBValue($params["NeedTimeKbn"],1) . ",";
		$strQry .= " :strComment ,";
// 		$strQry .= $this->convertDBValue($params["MailMgznFlg"],1) . ",";
		$strQry .= " :InquiryFlg ,";
		$strQry .= " :LpCampaignCd ,";
		$strQry .= " :LpRootCd , ";
		$strQry .= " :NameKana ";
		$strQry .= ")";
		
		// 20150219 S_Add
		$db_params['InqNo']        = $add_params["InqNo"];
		$db_params['ComGenruFlg']  = $add_params["ComGenruFlg"];
		$db_params['Name']         = $add_params["Name"];
		$db_params['NameKana']     = $add_params["NameKana"];
		$db_params['CntctWayCd']   = $add_params["CntctWayCd"];
		$db_params['Mail']         = $params["Mail"];
		$db_params['Tel']          = $params["Tel"];
		$db_params['Fax']          = $params["Fax"];
// 		$db_params['NeedTimeKbn']  = $params["NeedTimeKbn"];
		$db_params['strComment']   = $params["Comment"];
// 		$db_params['MailMgznFlg']   = $params["MailMgznFlg"];
		$db_params['InquiryFlg']   = $params["InquiryFlg"];
// 		$db_params['SrhKbn']       = $params["SrhKbn"];
// 		$db_params['UserComName']  = $params["UserComName"];
		
		$db_params['LpCampaignCd'] = $params["LpCampaignCd"];
		$db_params['LpRootCd']     = $params["LpRootCd"];
		// 20150219 E_Add
		
		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W25TOIAWASE_USER_LOG");
		return $resArr;
	}
	// 20141222 E_Add
	
	//社宅リクエストお問い合わせ
	public function insInqHoujinLog($db,$params,$add_params) {

		//ｸｴﾘ作成(リクエスト内容格納TBLに情報を格納する);
		$strQry = "INSERT INTO W73SHATAKU_REQUEST_LOG ( ";
		$strQry .= "W73_REQUEST_ID, ";
		$strQry .= "W73_KEIYAKU_KBN, ";
		$strQry .= "W73_COMPANY_NAME, ";
		$strQry .= "W73_NAME, ";
		$strQry .= "W73_MAIL, ";
		$strQry .= "W73_TEL, ";
		$strQry .= "W73_FAX, ";
		$strQry .= "W73_RENRAKU_SHUDAN, ";
		$strQry .= "W73_RENRAKU_JIKAN, ";
		$strQry .= "W73_TOIAWASE_NAIYO, ";
		$strQry .= "W73_AREA, ";
		$strQry .= "W73_ENSEN_EKI, ";
		$strQry .= "W73_SHUBETSU, ";
		$strQry .= "W73_YOSAN_MIN, ";
		$strQry .= "W73_YOSAN_MAX, ";
		$strQry .= "W73_YOSAN_YOBI, ";
		$strQry .= "W73_MADORI, ";
		$strQry .= "W73_SENYU_MIN, ";
		$strQry .= "W73_SENYU_MAX, ";
		$strQry .= "W73_CHIKUNENSU, ";
		$strQry .= "W73_EKITOHO, ";
		$strQry .= "W73_CHUSHAJO_DAISU, ";
		$strQry .= "W73_NYUKYO_KIBOUBI, ";
		$strQry .= "W73_NYUKYO_KIBOUBI_BIKO, ";
		$strQry .= "W73_NAIKEN_KIBOUBI, ";
		$strQry .= "W73_SONOTA_GOYOBO, ";
		$strQry .= "W73_TEIKEI_CAMPANY, ";
		$strQry .= "W73_DATE) ";
		$strQry .= "VALUES ( ";
		$strQry .=  $add_params['InqNo'] . ",";
		$strQry .=  $params['keiyakutype'] . ",";
		$strQry .= $this->convertDBValue($params['UserComName'],1) . ",";
		$strQry .= $this->convertDBValue($params['NameSei'] . "　" . $params['NameMei'],1) . ", ";
		$strQry .= $this->convertDBValue($params['Mail'],1) . ",";
		$strQry .= $this->convertDBValue($params['Tel'],1) . ",";
		$strQry .= $this->convertDBValue($params['Fax'],1) . ",";
		$strQry .= $this->convertDBValue($params['CntctWayCd'],1) . ",";
		$strQry .= $this->convertDBValue($params['NeedTimeKbn'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['InqryContents'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspKibouToshi'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspKibouEnsen'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspSyubetu'],1) . ",";
		$strQry .= $params['tinryo1'] . ",";
		$strQry .= $params['tinryo2'] . ",";
		$strQry .= $this->convertDBValue($add_params['HTinryoJkn'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspMadori'],1) . ",";
		$strQry .= $params['senyu1'] . ",";
		$strQry .= $params['senyu2'] . ",";
		$strQry .= $params['built'] . ",";
		$strQry .= $params['ekitoho'] . ",";
		$strQry .= $this->convertDBValue($params['chushajoDaisu'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspNyukyo'],1) . ",";
		$strQry .= $this->convertDBValue($params['nyukyoBiko'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['DspNaiken'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['KodawariData']['HKodawari'],1) . ",";
		$strQry .= $this->convertDBValue($add_params['strComName'],1) . ",";
		$strQry .= "SYSDATE";
		$strQry .= ")";

		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W73SHATAKU_REQUEST_LOG");

		return $resArr;
	}

	// 法人問い合わせ申し込み情報登録
	public function insCompanyToiawaseLog($db,$params) {

		$sQry .= "INSERT INTO W60COMPANY_TOIAWASE_LOG ( ";
		$sQry .= "W60_COMPANY_NAME, ";
		$sQry .= "W60_YUUBIN, ";
		$sQry .= "W60_TODOUFUKEN_CD, ";
		$sQry .= "W60_JYUUSHO_SHIKU, ";
		$sQry .= "W60_JYUUSHO_SONOTA, ";
		$sQry .= "W60_BUSHO, ";
		$sQry .= "W60_YAKUSHOKU, ";
		$sQry .= "W60_TANTOU_NAME, ";
		$sQry .= "W60_TANTOU_NAME_KANA, ";
		$sQry .= "W60_TEL, ";
		$sQry .= "W60_FAX, ";
		$sQry .= "W60_MAIL, ";
		$sQry .= "W60_URL, ";
		$sQry .= "W60_BIKOU, ";
		$sQry .= "W60_TOIAWASE_FLG, ";
		$sQry .= "W60_TOUROKUBI ";
		$sQry .= ") ";
		$sQry .= " VALUES (";
		$sQry .= "'" . $params['Company'] . "', ";
		$sQry .= "'" . $params['Zip1'] . $params['Zip2'] . "', ";
		$sQry .= "'" . $params['PrefCd'] . "', ";
		$sQry .= "'" . $params['Address1'] . "', ";
		$sQry .= "'" . $params['Address2'] . "', ";
		$sQry .= "'" . $params['Busho'] . "', ";
		$sQry .= "'" . $params['Yakushoku'] . "', ";
		$sQry .= "'" . $params['ChargeNm'] . "', ";
		$sQry .= "'" . $params['ChargeNmKana'] . "', ";
		$sQry .= "'" . $params['Tel'] . "', ";
		$sQry .= "'" . $params['Fax'] . "', ";
		$sQry .= "'" . $params['Mail'] . "', ";
		$sQry .= "'" . $params['Url'] . "', ";
		$sQry .= "'" . $params['Comment'] . "', ";
		$sQry .= "'" . $params['Inquiry1'] .  $params['Inquiry2'] .  $params['Inquiry3'] . "0000000', ";
		$sQry .= "SYSDATE ";
		$sQry .= ")";

		$resArr = $this->dbExecQuery($sQry, $db_params, $db,"W60COMPANY_TOIAWASE_LOG");

		return $resArr;

	}

	// 情報誌問い合わせ
	public function insJo($db,$params) {

		//ｸｴﾘ作成(申込み内容を登録する);
		$strQry = " INSERT INTO W50JYOUHOUSHI_MOUSHIKOMI_LOG( ";
		$strQry .= " W50_TOUROKUBI, ";
		$strQry .= " W50_SOUFU_JYOUHOUSHI_KUBUN, ";
		$strQry .= " W50_NAME, ";
		$strQry .= " W50_KANA, ";
		$strQry .= " W50_AGE_KUBUN, ";
		$strQry .= " W50_SEX, ";
		$strQry .= " M50_MARRY, ";
		$strQry .= " W50_JOB_KUBUN, ";
		$strQry .= " W50_YUUBIN, ";
		$strQry .= " W50_TODOUFUKEN_CD, ";
		$strQry .= " W50_JYUUSHO_BIKOU, ";
		$strQry .= " W50_TEL, ";
		$strQry .= " W50_FAX, ";
		$strQry .= " W50_MAIL, ";
		$strQry .= " W50_COMMENT, ";
		$strQry .= " W50_HIKKOSHI_RIYOU_KUBUN, ";
		$strQry .= " W50_HIKKOSHI_RIYOU_SONOTA, ";
		$strQry .= " W50_KOUNYUU_UMU_KUBUN, ";
		$strQry .= " W50_KIKKAKE_KUBUN, ";
		$strQry .= " W50_KIKKAKE_SONOTA, ";
		$strQry .= " W50_SANKOU_ZASSI_KUBUN, ";
		$strQry .= " W50_SANKOU_ZASSI_SONOTA, ";
		$strQry .= " W50_JYUUYOU_KOUMOKU_FLAG, ";
		$strQry .= " W50_JYUUYOU_KOUMOKU_SONOTA, ";
		$strQry .= " W50_NEED_TOKUSHUU, ";
		$strQry .= " W50_NEED_TOKUSHUU_SONOTA ";
		$strQry .= " ) ";
		$strQry .= " VALUES( ";
		$strQry .= " SYSDATE, ";
		$strQry .= $params['SoufuKibouJyouhoushi'] . ", ";
		$strQry .= " '" . $params['NameSei'] . $params['NameMei'] . "', ";
		$strQry .= " '" . $params['KanaSei'] . $params['KanaMei'] . "', ";
		$strQry .= $params['AgeKbn'] . ", ";
		$strQry .= $this->convertDBValue($params['Sex'],1) . ", ";
		$strQry .= $this->convertDBValue($params['Mrrg'],1) . ", ";
		$strQry .= $this->convertDBValue($params['JobKbn'],1) . ", ";
		$strQry .= " '" . $params['Zip1'] . $params['Zip2'] . "', ";
		$strQry .= " '" . $params['PrefCd'] . "', ";
		$strQry .= " '" . $params['Address'] . "', ";
		$strQry .= " '" . $params['Tel'] . "', ";
		$strQry .= " '" . $params['Fax'] . "', ";
		$strQry .= " '" . $params['Mail'] . "', ";
		$strQry .= " '" . $params['Comment'] . "', ";
		$strQry .= $this->convertDBValue($params['HikkoshiRiyuu']) . ", ";
		$strQry .= " '" . $params['HikkoshiRiyuuSonota'] . "', ";
		$strQry .= $this->convertDBValue($params['KounyuuKeiken']) . ", ";
		$strQry .= $this->convertDBValue($params['Kikkake']) . ", ";
		$strQry .= " '" . $params['KikkakeSonota'] . "', ";
		$strQry .= $this->convertDBValue($params['SonotaZassi'],1) . ", ";
		$strQry .= " '" . $params['SonotaZassiName'] . "', ";
		$strQry .= " '" . $params['JyuushiKoumoku'] . "', ";
		$strQry .= " '" . $params['JyuushiKoumokuSonota'] . "', ";
		$strQry .= " '" . $params['NeedTokushuu'] . "', ";
		$strQry .= " '" . $params['NeedTokushuuSonota'] . "') ";

		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W50JYOUHOUSHI_MOUSHIKOMI_LOG");
		return $resArr;
	}


	// 店舗情報取得処理
	public function getInqShopQry($params,$db = "") {


		$strQry = "SELECT ";
		$strQry .= "M05_TENPO_CD, ";
		$strQry .= "M05_TENPO_NAME, ";
		$strQry .= "M05_TENPO_TEL01, ";
		$strQry .= "M05_TENPO_MAIL ";
		$strQry .= "FROM M05TENPO_INFO ";
		$strQry .= "WHERE M05_TENPO_CD IN (" . $params['ShopCd'] . ") ";

		$list = $this->dbGetList($strQry, $db_params,$db);
		return $list;

	}

	// 店舗情報取得処理
	public function getInqShop2Qry($params) {

		foreach ($params['arrSelShop'] as $key => $value) {
			if ($strShopWhere != "" )
			{
				$strShopWhere = $strShopWhere . " OR";
			}
			$strShopWhere = $strShopWhere . " M05_TENPO_CD = '" . $value . "'";
		}

		$strShopWhere = " (" . $strShopWhere . ")";

		$strQry = "SELECT ";
		$strQry .= "M05_TENPO_CD, ";
		$strQry .= "M05_TENPO_NAME, ";
		$strQry .= "M05_TENPO_TEL01, ";
		$strQry .= "M05_TENPO_MAIL ";
		$strQry .= "FROM M05TENPO_INFO ";
		$strQry .= " WHERE" . $strShopWhere;
		$strQry .= " AND M05_KOUKAI_FLAG = 1";
		//$strQry .= " AND M05_TENPO_CD <> '03008604'";
		$strQry .= " AND (M05_TENPO_CD > '01000000' AND M05_TENPO_CD < '48000000')";
		$strQry .= " ORDER BY M05_TENPO_CD";

		$list = $this->dbGetList($strQry, $db_params);
		return $list;

	}

	// 都道府県取得処理
	public function getInqPrefQry($db,$params) {

		$strQry = "SELECT M43_TODOUFUKEN FROM M43TODOUFUKEN WHERE M43_TODOUFUKEN_CD  = '" . $params['PrefCd'] . "' ";

		$list = $this->dbGetList($strQry, $db_params);
		return $list;
	}

	// 提携企業情報取得
	public function getInqCompanyQry($params) {
		$db_params = array();

		$strQry = "SELECT M86_COMPANY_NAME, M86_SHATAKU_KOUJYORITSU, M86_GENRU_FLAG, M86_TENSOU_MAIL";
		$strQry .= " FROM M86SHATAKU_TEIKEI_COMPANY";
		$strQry .= " WHERE M86_COMPANY_CD = :ComId ";
		$db_params['ComId'] = $params['ComId'];

		$list = $this->dbGetList($strQry, $db_params);
		return $list;
	}


	//対応履歴用ﾃﾞｰﾀ登録処理
	public function insTaiou($db,$params,$add_params) {

		$strComment1 = mb_substr(str_replace("'", "''",$params['Comment']), 0, 1900);
		$strComment2 = mb_substr(str_replace("'", "''",$params['Comment']), 1900, 1900);
		$strComment3 = mb_substr(str_replace("'", "''",$params['Comment']), 3800, 1900);

		//ｸｴﾘ作成処理(対応履歴ﾃｰﾌﾞﾙにﾃﾞｰﾀを挿入する)
		$strQry = " INSERT INTO C02TAIOU ( ";
		$strQry = $strQry . "C02_ID, ";
		$strQry = $strQry . "C02_MID, ";
		$strQry = $strQry . "C02_KOUMOKU_CD, ";
		$strQry = $strQry . "C02_KOUMOKU_CD_SHOW, ";
		$strQry = $strQry . "C02_CATEGORY_CD, ";
		$strQry = $strQry . "C02_NAIYOUKOUMOKU, ";
		$strQry = $strQry . "C02_STATUS_CD, ";
		$strQry = $strQry . "C02_TAISHOU_ICON, ";
		$strQry = $strQry . "C02_TAISHOU_HOUZIN_CD, ";
		$strQry = $strQry . "C02_TAISHOU_TENPO_CD, ";
		$strQry = $strQry . "C02_TAISHOU_OWNER_CD, ";
		$strQry = $strQry . "C02_TAISHOU_SONOTA_CD, ";
		$strQry = $strQry . "C02_TAISHOUSHA_NAME, ";
		$strQry = $strQry . "C02_TOUROKUBI, ";
		$strQry = $strQry . "C02_HOUKOKUBI, ";
		$strQry = $strQry . "C02_TOUKOUSHA_ICON, ";
		$strQry = $strQry . "C02_TOUKOUSHA_HOUZIN_CD, ";
		$strQry = $strQry . "C02_TOUKOUSHA_TENPO_CD, ";
		$strQry = $strQry . "C02_TOUKOUSHA_OWNER_CD, ";
		$strQry = $strQry . "C02_TOUKOUSHA_SONOTA_CD, ";
		$strQry = $strQry . "C02_TOUKOUSHA, ";
		$strQry = $strQry . "C02_TOUKOUSHA_BIKOU, ";
		$strQry = $strQry . "C02_TOUKOUSHA_TEL, ";
		$strQry = $strQry . "C02_TOUKOUSHA_MAIL, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_ICON, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_HOUZIN_CD, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_TENPO_CD, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_OWNER_CD, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_SONOTA_CD, ";
		$strQry = $strQry . "C02_HOUKOKUSHA, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_BIKOU, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_TEL, ";
		$strQry = $strQry . "C02_HOUKOKUSHA_MAIL, ";
		$strQry = $strQry . "C02_TITLE, ";
		$strQry = $strQry . "C02_NAIYOU1, ";
		$strQry = $strQry . "C02_NAIYOU2, ";
		$strQry = $strQry . "C02_NAIYOU3, ";
		$strQry = $strQry . "C02_BIKOU, ";
		$strQry = $strQry . "C02_HENSHINSUU, ";
		$strQry = $strQry . "C02_IMPORTANT_LEVEL, ";
		$strQry = $strQry . "C02_DELETE_FLAG, ";
		$strQry = $strQry . "C02_SAKUSEIBI, ";
		$strQry = $strQry . "C02_NYUURYOKUSHA_CD ) ";
		$strQry = $strQry . " VALUES( ";
		$strQry = $strQry . "TO_CHAR(SYSDATE, 'YYMMDDHH24MISS') || LPAD(SEQ_CLAIM_ID.NEXTVAL, 2, '0'), ";
		$strQry = $strQry . "'00000000000000', ";
		$strQry = $strQry . "TO_CHAR(SYSDATE,'YYMMDDHH24MISS') || LPAD(SEQ_CLAIM_ID.NEXTVAL, 2, '0'), ";
		$strQry = $strQry . "LPAD(SEQ_CLAIM_KOUMOKU_CD.NEXTVAL, 5, '0'), ";
		$strQry = $strQry . "'" . $params['CtgryCd'] . "', ";
		$strQry = $strQry . "'" . $params['TargetKbn'] . "', ";
		$strQry = $strQry . "'04', ";
		$strQry = $strQry . "'" . $add_params['ClaimTgtKbnIcon'] . "', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "'" . $add_params['UserCd'] . "', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . $add_params['UserSonotaCd'] . ", ";
		//担当が入力してあった時
		if (trim($params['Charge']) != "") {
			$strQry = $strQry . "'" . mb_substr(trim( $params['Charge']), 0, 10) . "', ";
		}else {
			$strQry = $strQry . "NULL, ";
		}
		$strQry = $strQry . "SYSDATE, ";
		$strQry = $strQry . "SYSDATE, ";
		$strQry = $strQry . "'01', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "'" . Apm_Config_Inquiry::TAIOU_USR_CD_SONOTA . "', ";
		$strQry = $strQry . "'" .  $params['Name'] . "', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "'" . trim($params['Tel']) . "', ";
		$strQry = $strQry . "'" . trim($params['Mail']) . "', ";
		$strQry = $strQry . "'01', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "'" . Apm_Config_Inquiry::TAIOU_USR_CD_SONOTA . "', ";
		$strQry = $strQry . "'" . trim($params['Name']) . "', ";
		$strQry = $strQry . "NULL, ";
		$strQry = $strQry . "'" . trim($params['Tel']) . "', ";
		$strQry = $strQry . "'" . trim($params['Mail']) . "', ";
		$strQry = $strQry . "'" . $add_params['TitleMail'] . "', ";
		$strQry = $strQry . "'" . $strComment1 . "', ";
		$strQry = $strQry . "'" . $strComment2 . "', ";
		$strQry = $strQry . "'" . $strComment3 . "', ";
		$strQry = $strQry . $add_params['Bikou'] . ",";
		$strQry = $strQry . "0, ";
		$strQry = $strQry . "1, ";
		$strQry = $strQry . "0, ";
		$strQry = $strQry . "SYSDATE, ";
		$strQry = $strQry . "'" . Apm_Config_Inquiry::TAIOU_USR_CD_END . "' ) ";

		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"C02TAIOU");

		return $resArr;

	}

	/**
	 * リクエスト検索情報ログ取得
	 * @param unknown_type $db
	 * @param unknown_type $params
	 * @param unknown_type $add_params
	 * @return unknown
	 */
	public function pageViewLog($db,$params,$add_params) {

		$db_params = array();
		//ｸｴﾘ作成処理(対応履歴ﾃｰﾌﾞﾙにﾃﾞｰﾀを挿入する)
		$strQry = " INSERT INTO W21PAGE_VIEW_LOG ( ";
		$strQry = $strQry . "W21_TENPO_CD, ";
		$strQry = $strQry . "W21_KENSAKU_FLAG, ";
		$strQry = $strQry . "W21_GENRU_FLAG, ";
		$strQry = $strQry . "W21_ORIGINAL_HEYA_CD, ";
		$strQry = $strQry . "W21_ORIGINAL_TATEMONO_CD, ";// 20141211 Add
		$strQry = $strQry . "W21_COUNT ) ";
		$strQry = $strQry . " VALUES( ";
		$strQry = $strQry . " :ShopCd ,";
		$strQry = $strQry . " :ViewKbn , ";
		$strQry = $strQry . " :ComGenruFlg , ";
		$strQry = $strQry . " :OrgHeyaCd , ";
		$strQry = $strQry . " :OrgTatemonoCd , ";// 20141211 Add
		$strQry = $strQry . " 1 ) ";

		$db_params['ShopCd']      = $params['ShopCd'];
		$db_params['ViewKbn']     = $add_params['ViewKbn'];
		$db_params['ComGenruFlg'] = $add_params['ComGenruFlg'];
		if (!Apm_Otheritems::IsNullOrEmpty($add_params['OrgHeyaCd'])) {
			$db_params['OrgHeyaCd'] = $add_params['OrgHeyaCd'];
		} else {
			$db_params['OrgHeyaCd'] = '';
		}
		// 20141211 S_Add
		// オリジナル建物CDがnullの場合、nullをセットする
		if (!Apm_Otheritems::IsNullOrEmpty($add_params['OrgTatemonoCd'])) {
			$db_params['OrgTatemonoCd'] = $add_params['OrgTatemonoCd'];
		} else {
			$db_params['OrgTatemonoCd'] = '';
		}
		// 20141211 E_Add

		__log_error ( __FILE__, __LINE__, __METHOD__, "おおおお" . $strQry);
		__log_error_array(__FILE__, __LINE__, __METHOD__, $db_params);
		
		$resArr = $this->dbExecQuery($strQry, $db_params, $db,"W21PAGE_VIEW_LOG");

		return $resArr;

	}

	/**
	 * リクエスト検索情報ログ
	 * @param unknown_type $db
	 * @param unknown_type $params
	 * @param unknown_type $add_params
	 * @return unknown
	 */
	public function requestKensakuLog($db,$params,$add_params) {

		//ｸｴﾘ作成処理(対応履歴ﾃｰﾌﾞﾙにﾃﾞｰﾀを挿入する)
		$sSQL  = "INSERT INTO W47REQUEST_KENSAKU_LOG (";
		$sSQL .= "W47_TOIAWASE_ID, ";
		$sSQL .= "W47_YACHIN_RANGE_MIN, ";
		$sSQL .= "W47_YACHIN_RANGE_MAX, ";
		$sSQL .= "W47_KANRIHI_KOMI_FLAG, ";
		$sSQL .= "W47_TRIPLE_ZERO_FLAG, ";
		$sSQL .= "W47_TATEMONO_TYPE, ";
		$sSQL .= "W47_EKI_TOHO, ";
		$sSQL .= "W47_SENYU_MENSEKI_MIN, ";
		$sSQL .= "W47_SENYU_MENSEKI_MAX, ";
		$sSQL .= "W47_MADORI, ";
		$sSQL .= "W47_CHIKUNENSU, ";
		$sSQL .= "W47_KODAWARI01, ";
		$sSQL .= "W47_KODAWARI02, ";
		$sSQL .= "W47_KODAWARI03, ";
		$sSQL .= "W47_FREERENT_FLAG, ";
		$sSQL .= "W47_HEYAWARI_FLAG) ";
		$sSQL .= "VALUES(";
		$sSQL .=  $add_params['InqNo'] . ",";
		$sSQL .=  $add_params['ReqData']['iYachinMin'] . ", ";
		$sSQL .=  $add_params['ReqData']['iYachinMax'] . ", ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iKanrihiFlg']) . ", ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iShikireiFlg']) . ", ";
		$sSQL .=  "'" . $add_params['ReqData']['sTatemonoType'] . "', ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iEkitoho']) . ", ";
		//$sSQL .=  $params['ekitoho'] . ", ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iSenyuMin']) . ", ";
		$sSQL .=  $add_params['ReqData']['iSenyuMax'] . ", ";
		$sSQL .=  "'" . $add_params['ReqData']['sMadori'] . "', ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iChikunensu']) . ", ";
		$sSQL .=  "null, ";
		$sSQL .= "'000', ";
		$sSQL .=  "'" . $add_params['KodawariData']['vKodawari'] . "', ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iFreeRentFlg']) . ", ";
		$sSQL .=  $this->makeParamString($add_params['ReqData']['iHeyaWariFlg']) . ") ";

		$resArr = $this->dbExecQuery($sSQL, $db_params, $db,"W47REQUEST_KENSAKU_LOG");

		return $resArr;

	}
	
	public function  makeParamString($val){
		if(Apm_Otheritems::IsNullOrEmpty($val)){
			return "null";
		}
		else 
			return $val;
	}

	//AS問合せ時の物件リスト取得
	public function GetInqASBukkenList($bukkenIds,$add_params) {

		//========================================================
		//= 変数初期化

		$bukkenIdQry = "";
		$bukkenIdList = split(",", str_replace(" ", "", $bukkenIds));

		//========================================================
		//= ｸｴﾘ用文字列の作成

		//対象部屋ﾃﾞｰﾀ一覧の取得
		foreach ($bukkenIdList as $bukkenId)
		{
			if (!Apm_Otheritems::IsNullOrEmpty($bukkenIdQry))
			{
				$bukkenIdQry .= " OR ";
			}
			$bukkenIdQry .= "T03_HEYA_CD = " . $bukkenId . " ";
		}

		//========================================================
		//= ｸｴﾘ用作成
		//ｸｴﾘ作成(問合わせ物件情報を取得する)
		$strQry  = "SELECT ";
		$strQry .= "T03_ORIGINAL_TATEMONO_CD01, ";
		$strQry .= "T03_ORIGINAL_HEYA_CD01, ";
		$strQry .= "T03_TATEMONO_CD, ";
		$strQry .= "T03_HEYA_BANGOU, ";
		$strQry .= "T03_JYUUSHO_TEXT, ";
		$strQry .= "T03_TATEMONO_NAME, ";
		$strQry .= "T03_HEYA_CD, ";
		$strQry .= "T03_TODOUFUKEN_CD, ";
		$strQry .= "T03_TENPO_CD, T03_TENPO_NAME, ";
		$strQry .= "T03_ENSEN_NAME, T03_EKI_NAME, ";
		$strQry .= "T03_MADORI, ";
		$strQry .= "T03_YACHIN, T03_YACHIN_TAX, ";
		$strQry .= "T03_KANRIHI, T03_KANRIHI_TAX, ";
		$strQry .= "T03_REIKIN, T03_REIKIN_TSUKISUU, ";
		$strQry .= "T03_SHIKIKIN, T03_SHIKIKIN_TSUKISUU, ";
		$strQry .= "T03_hoshoukin, T03_hoshoukin_tsukisuu, ";
		$strQry .= "T03_shoukyakukin, t03_shoukyakukin_tsukisuu, ";
		$strQry .= "T03_BUS_GAISHA, T03_BUS_STOP, T03_BUS_JYOUSHA, ";
		$strQry .= "T03_TOHO01,T03_SENYUU_MENSEKI, ";
		$strQry .= "T03_TATEMONO_KOUZOU, ";
		$strQry .= "T03_KANSEINEN, T03_KANSEITSUKI, ";
		$strQry .= "T03_GAIKAN_GAZOU01, T03_MADORIZU,";
		$strQry .= "M05_TENPO_CD, ";
		$strQry .= "M05_TENPO_NAME, ";
		$strQry .= "M05_TENPO_TEL01, ";
		$strQry .= "M05_TENPO_MAIL, ";
		$strQry .= "T03_KOUKOKU_KAISHA_CD, ";
		$strQry .= "T03_KOUKOKU_TOIAWASE_NO, ";
		$strQry .= "T03_KASHIDASHI_KUBUN, ";
		$strQry .= "CASE WHEN T03_SHATAKU_TEKIYOU_FLAG = 1 AND (T03_TORIHIKI_TAIYOU = 1 OR T03_TORIHIKI_TAIYOU = 9) THEN 100 ";
		$strQry .= "WHEN T03_SHATAKU_TEKIYOU_FLAG = 1 AND M05_SHATAKU_KOUJYORITSU <= " . $add_params['intKoujyoRitsu'] . " AND T03_TORIHIKI_TAIYOU <> 1 THEN M05_SHATAKU_KOUJYORITSU ";
		$strQry .= "WHEN T03_SHATAKU_TEKIYOU_FLAG = 1 AND M05_SHATAKU_KOUJYORITSU > " . $add_params['intKoujyoRitsu'] ." AND T03_TORIHIKI_TAIYOU <> 1 THEN ".  $add_params['intKoujyoRitsu'] . " ";
		$strQry .= "ELSE 0 ";
		$strQry .= "END AS SHATAKU_KOUJYORITSU ";
		$strQry .= "FROM T03WEB_HEYA ,M05TENPO_INFO ";
		$strQry .= "WHERE ( " . $bukkenIdQry . " )";
		$strQry .= "AND M05_TENPO_CD(+) = T03_TENPO_CD ";
		$strQry .= "ORDER BY T03_TENPO_CD ";

		$result = $this->dbGetList($strQry, $db_params);

		return $result;
	}


	//AS問合せの物件登録
	public function insToiawaseBukken($db,$params,$add_params) {

		//========================================================
		//= 変数初期化
		//========================================================

			$intGazouSet = 0;
			//外観画像が設定されていた場合
			if ($add_params['T03_GAIKAN_GAZOU01'] != "") {
				$intGazouSet = 1;
			}
			//間取図が設定されていた場合
			if ($add_params['T03_MADORIZU'] != "") {
				$intGazouSet = $intGazouSet + 2;
			}

		//========================================================
		//= ｸｴﾘ作成
		//========================================================

			//ｸｴﾘ作成(問合わせ物件履歴TBLにﾃﾞｰﾀを挿入する)
			$strQry = "INSERT INTO W26TOIAWASE_BUKKEN( ";
			$strQry .= "W26_TOIAWASE_ID, ";
			$strQry .= "W26_TENPO_CD, ";
			$strQry .= "W26_ORIGINAL_HEYA_CD01, ";
			$strQry .= "W26_ENSEN_NAME, ";
			$strQry .= "W26_EKI_NAME, ";
			$strQry .= "W26_MADORI, ";
			$strQry .= "W26_YACHIN, ";
			$strQry .= "W26_YACHIN_TAX, ";
			$strQry .= "W26_KANRIHI,";
			$strQry .= "W26_KANRIHI_TAX,";
			$strQry .= "W26_REIKIN, ";
			$strQry .= "W26_REIKIN_TSUKISUU, ";
			$strQry .= "W26_SHIKIKIN, ";
			$strQry .= "W26_SHIKIKIN_TSUKISUU, ";
			$strQry .= "W26_HOSHOUKIN, ";
			$strQry .= "W26_HOSHOUKIN_TSUKISUU, ";
			$strQry .= "W26_SHOUKYAKUKIN, ";
			$strQry .= "W26_SHOUKYAKUKIN_TSUKISUU, ";
			$strQry .= "W26_BUS_GAISHA, ";
			$strQry .= "W26_BUS_STOP, ";
			$strQry .= "W26_BUS_JYOUSHA, ";
			$strQry .= "W26_TOHO01, ";
			$strQry .= "W26_SENYUU_MENSEKI, ";
			$strQry .= "W26_TATEMONO_KOUZOU, ";
			$strQry .= "W26_KANSEINEN, ";
			$strQry .= "W26_KANSEITSUKI, ";
			$strQry .= "W26_GAZOU_SETTEI ) ";
			$strQry .= "VALUES ( ";
			$strQry .= $add_params['InqNo'] . ", ";
			$strQry .= $add_params['T03_TENPO_CD'] . ", ";
			$strQry .= $add_params['T03_ORIGINAL_HEYA_CD01'] . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_ENSEN_NAME']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_EKI_NAME']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_MADORI']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_YACHIN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_YACHIN_TAX']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_KANRIHI']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_KANRIHI_TAX']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_REIKIN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_REIKIN_TSUKISUU']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_SHIKIKIN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_SHIKIKIN_TSUKISUU']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_HOSHOUKIN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_HOSHOUKIN_TSUKISUU']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_SHOUKYAKUKIN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_SHOUKYAKUKIN_TSUKISUU']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_BUS_GAISHA']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_BUS_GAISHA']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_BUS_JYOUSHA']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_TOHO01']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_SENYUU_MENSEKI']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_TATEMONO_KOUZOU']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_KANSEINEN']) . ", ";
			$strQry .= $this->convertDBValue($add_params['T03_KANSEITSUKI']) . ", ";
			$strQry .= $intGazouSet ;
			$strQry .= ")";

			return $this->dbExecQuery($strQry, $db_params, $db, "W26TOIAWASE_BUKKEN");
	}

		/**
	 * W03BUKKEN_ACCESS_LOG 情報挿入
	 *
	 * @param connection $db DBコネクション
	 * @param array $params パラメータ
	 *		strToiawaseCd	管理物件問合せ番号CD
	 *		strKaishaCd		管理会社CD
	 *		strPrefCd		都道府県CD
	 *		strTenpoCd		店舗CD
	 *		intKoumokuFlg	項目ﾌﾗｸﾞ(1:ﾀﾞｳﾝﾛｰﾄﾞ 2:公開 3:ﾍﾟｰｼﾞﾋﾞｭｰ 4:ﾒｰﾙ)
	 *		intSiteFlg		掲載ｻｲﾄﾌﾗｸﾞ(1:HP 2:i 3:j 4:ez 5:ｷｬﾝﾊﾟｽ 6:ﾀﾞﾌﾞﾙｾﾞﾛ 7:PDA)
	 *
	 * @return 処理件数
	 */
	public function InsKanriBkknLog($db,$params)
	{
		$sql = "";
		$db_params = array();

		$sql .= "INSERT INTO WEBLOG1_USER.W03BUKKEN_ACCESS_LOG ( ";
		$sql .= "  W03_KOUKOKU_KAISHA_TOIAWASE_CD, ";
		$sql .= "  W03_KOUKOKU_KAISHA_CD, ";
		$sql .= "  W03_TODOUFUKEN_CD, ";
		$sql .= "  W03_TENPO_CD, ";
		$sql .= "  W03_KOUMOKU_FLAG, ";
		$sql .= "  W03_SITE_FLAG, ";
		$sql .= "  W03_DATE ";
		$sql .= ") VALUES ( ";
		$sql .= "  :strToiawaseCd, ";
		$sql .= "  :strKaishaCd, ";
		$sql .= "  :strPrefCd, ";
		$sql .= "  :strTenpoCd,";
		$sql .= "  :intKoumokuFlg,";
		$sql .= "  :intSiteFlg,";
		$sql .= "  SYSDATE";
		$sql .= ")";

		$db_params['strToiawaseCd'] = $params['strPmInqNo'];
		$db_params['strKaishaCd'] = $params['strPmCmpnyCd'];
		$db_params['strPrefCd'] = $params['strPrefCd'];
		$db_params['strTenpoCd'] = $this->_params['ShopCd'];
		$db_params['intKoumokuFlg'] = "4";
		$db_params['intSiteFlg'] = "1";

		return $this->dbExecQuery($sql, $db_params, $db, "WEBLOG1_USER.W03BUKKEN_ACCESS_LOG");
	}

	/**
	 * 他店舗検索
	 * @param DB $db
	 * @param パラメータ $params
	 * @return 店舗リスト
	 */
	public function getBukkenAdjest($db,$params)
	{
		$strQry =  "SELECT ";
		$strQry .= "T03_HEYA_CD, ";
		$strQry .= "M05_TENPO_CD, ";
		$strQry .= "M05_TENPO_NAME, ";
		$strQry .= "M05_JYUUSHO_TEXT, ";
		$strQry .= "M05_TENPO_BANCHI, ";
		$strQry .= "M05_TENPO_JYUUSHO_BIKOU, ";
		$strQry .= "RANDOM_INDEX ";
		$strQry .= "FROM ( ";
		$strQry .= "SELECT ";
		$strQry .= "T03_HEYA_CD, ";
		$strQry .= "M05_TENPO_CD, ";
		$strQry .= "M05_TENPO_NAME, ";
		$strQry .= "M05_JYUUSHO_TEXT, ";
		$strQry .= "M05_TENPO_BANCHI, ";
		$strQry .= "M05_TENPO_JYUUSHO_BIKOU, ";
		$strQry .= "SUBSTR(LPAD(TO_CHAR( TO_NUMBER(SUBSTR(M05_TENPO_CD,3,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,4,1)) ";
		$strQry .= "+ TO_NUMBER(SUBSTR(M05_TENPO_CD,5,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,6,1)) + TO_NUMBER(SUBSTR(M05_TENPO_CD,7,1)) ";
		$strQry .= "+ TO_NUMBER(SUBSTR(M05_TENPO_CD,8,1)) + TO_NUMBER(TO_CHAR(SYSDATE,'SS'))),3,'0'),3,1) AS RANDOM_INDEX ";
		$strQry .= "FROM T03WEB_HEYA, M05TENPO_INFO ";
		$strQry .= "WHERE T03_TENPO_CD = M05_TENPO_CD ";
		$strQry .= "AND T03_TENPO_CD <> '" . $params['ShopCd'] . "' ";
		$strQry .= "AND T03_KOUKOKU_TOIAWASE_NO = '" . $params['BukkenCd'] . "') ";
		$strQry .= "ORDER BY RANDOM_INDEX";

		$result = $this->dbGetList($strQry, $db_params);
		return $result;

	}

	/**
	 * リクエストエリアログ情報登録処理
	 * @param unknown_type $db
	 * @param unknown_type $params
	 */
	public function InsRequestAreaLog($db,$params,$add_params)
	{
		$db_params = array();
		$strQry = "";
		//ｸｴﾘ作成(ﾘｸｴｽﾄｴﾘｱﾛｸﾞ情報を登録する)
		$strQry .= "INSERT INTO W33REQUEST_AREA_LOG ( ";
		$strQry .= " W33_TOIAWASE_ID, ";
		$strQry .= " W33_REQUEST_SEQ, ";
		$strQry .= " W33_REQUEST_FLAG, ";
		$strQry .= " W33_TODOUFUKEN_CD, ";
		$strQry .= " W33_ENSEN_CD, ";
		$strQry .= " W33_EKI_CD, ";
		$strQry .= " W33_SHIKUCHOUSON_CD, ";
		$strQry .= " W33_CHOUMEI_CD )";
		$strQry .= " VALUES ( ";
		$strQry .= " :InqNo ,";
		$strQry .= " :Seqcount ,";
		$strQry .= " :SrhType ,";
		$strQry .= " :targetPrefCd ,";
		$strQry .= " :targetRailCd ,";
		$strQry .= " :targetStCd ,";
		$strQry .= " :targetCityCd ,";
		$strQry .= " :targetTownCd ";
		$strQry .= " )";

		$db_params['InqNo']        = $add_params['InqNo'];
		$db_params['Seqcount']     = $add_params['Seqcount'];
		$db_params['SrhType']      = $params['SrhType'];
		$db_params['targetPrefCd'] = $add_params['targetPrefCd'];
		$db_params['targetRailCd'] = $add_params['targetRailCd'];
		$db_params['targetStCd']   = $add_params['targetStCd'];
		$db_params['targetCityCd'] = $add_params['targetCityCd'];
		$db_params['targetTownCd'] = $add_params['targetTownCd'];

		return $this->dbExecQuery($strQry, $db_params, $db, "W33REQUEST_AREA_LOG");
	}


	/**
	 * リクエスト手動メール情報登録処理
	 * @param unknown_type $db
	 * @param unknown_type $params
	 */
	public function InsRequestShudouLog($db,$params,$add_params)
	{

		$sSQL  = "INSERT INTO W48SHUDOU_REQUEST_MAIL (";
		$sSQL .= "W48_TOIAWASE_ID, ";
		$sSQL .= "W48_GENRU_FLAG, ";
		$sSQL .= "W48_NAME, ";
		$sSQL .= "W48_MAIL) ";
		$sSQL .= "VALUES(";
		$sSQL .= $add_params['InqNo'] . ", ";
		$sSQL .= $add_params['ComGenruFlg'] . ", ";
		$sSQL .= "'" . $params['Name'] . "', ";
		$sSQL .= "'" . $params['Mail'] . "') ";

		return $this->dbExecQuery($sSQL, $db_params, $db, "W48SHUDOU_REQUEST_MAIL");
	}


	/* データベースに対してINSERT,UPDATE,DELETEを実行する<br>
     *
     * @param string $sql SQL文
     * @param array $db_params バインド変数
     * @return $resArr 更新結果情報配列
     */
    protected function dbExecQuery($sql, $db_params = "", $db,$tableName)
    {
        __log_debug(__FILE__, __LINE__, __METHOD__, '---------->>>');
        
        if(empty($db_params)){
            $result = $db->query($sql);
        }
        else{
            $result = $db->query($sql, $db_params);
        }
        
        $resArr = array("table_name"=>$tableName,"count"=>$result->rowCount());

        $profiler = $db->getProfiler();
        __log_debug(__FILE__, __LINE__, __METHOD__, 'クエリ実行所要時間 = '.$profiler->getTotalElapsedSecs());
        __log_debug(__FILE__, __LINE__, __METHOD__, '----------<<<');
        return $resArr;
    }

     /**
	 * 問い合わせ店舗情報登録
	 *
	 * @param string $strToiawaseId 問合せID
	 * @param array $strTenpoId 店舗店舗ID
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsInqTenpoLog($strToiawaseId, $strTenpoId, $db)
	{

		$sql = "";
		$db_params = array();
		$db_params['toiawaseId'] = $strToiawaseId;
		$db_params['tenpoId'] =  $strTenpoId;

		//========================================================
		//= ｸｴﾘ作成

		$sql .= "INSERT INTO WEBLOG1_USER.W26TOIAWASE_TENPO( ";
		$sql .= "W26_TOIAWASE_ID, ";
		$sql .= "W26_TENPO_CD ";
		$sql .= ") ";
		$sql .= "VALUES ( ";
		$sql .= " :toiawaseId, ";
		$sql .= " :tenpoId ";
		$sql .= ")";

		//========================================================
		//= ｸｴﾘ発行
		return $this->dbExecQuery($sql, $db_params, $db,"WEBLOG1_USER.W26TOIAWASE_TENPO");
	}
	// 20141212 S_Add
	/**
	 * 問い合わせ建物情報登録
	 *
	 * @param string $strToiawaseId 問合せID
	 * @param パラメータ $params
	 * @param connection $db DBコネクション
	 *
	 * @return 処理件数
	 */
	public function InsInqTatemonoLog($strToiawaseId, $add_params, $db)
	{
		$sql = "";
		
		//========================================================
		//= ｸｴﾘ作成
		
		$sql .= "INSERT INTO WEBLOG1_USER.W26TOIAWASE_TATEMONO( ";
		$sql .= "W26_TOIAWASE_ID, ";
		$sql .= "W26_TENPO_CD, ";
		$sql .= "W26_ORIGINAL_TATEMONO_CD01, ";
		$sql .= "W26_ENSEN_NAME, ";
		$sql .= "W26_EKI_NAME, ";
		$sql .= "W26_BUS_GAISHA, ";
		$sql .= "W26_BUS_STOP, ";
		$sql .= "W26_BUS_JYOUSHA, ";
		$sql .= "W26_TOHO01, ";
		$sql .= "W26_TATEMONO_KOUZOU, ";
		$sql .= "W26_KANSEINEN, ";
		$sql .= "W26_KANSEITSUKI ";
		$sql .= ") ";
		$sql .= "VALUES ( ";
		$sql .= $this->convertDBValue($strToiawaseId,1) . ", ";
		$sql .= $this->convertDBValue($add_params['ShopCd'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['OrgTatemonoCd'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['EnsenName'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['EkiName'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['BusGaisha'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['BusStop'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['BusJyousha'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['Toho01'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['TatemonoKouzou'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['Kanseinen'],1) . ", ";
		$sql .= $this->convertDBValue($add_params['Kanseitsuki'],1);
		$sql .= ")";
	
		//========================================================
		//= ｸｴﾘ発行
		return $this->dbExecQuery($sql, $db_params, $db,"WEBLOG1_USER.W26TOIAWASE_TENPO");
	}
	// 20141212 E_Add
	
	// 20141224 S_Add
	/**
	 * リクエスト検索情報ログ
	 * @param unknown_type $db
	 * @param unknown_type $params
	 * @param unknown_type $add_params
	 * @return unknown
	 */
	public function requestKensakuLog2($db,$params,$add_params) {
	
		//ｸｴﾘ作成処理(対応履歴ﾃｰﾌﾞﾙにﾃﾞｰﾀを挿入する)
		$sSQL  = "INSERT INTO W47REQUEST_KENSAKU_LOG (";
		$sSQL .= "W47_TOIAWASE_ID, ";
		$sSQL .= "W47_YACHIN_RANGE_MIN, ";
		$sSQL .= "W47_YACHIN_RANGE_MAX, ";
		$sSQL .= "W47_KANRIHI_KOMI_FLAG, ";
// 		$sSQL .= "W47_TRIPLE_ZERO_FLAG, ";
		$sSQL .= "W47_TATEMONO_TYPE, ";
		$sSQL .= "W47_EKI_TOHO, ";
		$sSQL .= "W47_SENYU_MENSEKI_MIN, ";
		$sSQL .= "W47_SENYU_MENSEKI_MAX, ";
		$sSQL .= "W47_MADORI, ";
		$sSQL .= "W47_CHIKUNENSU, ";
		$sSQL .= "W47_KODAWARI01, ";
		$sSQL .= "W47_KODAWARI02, ";
		$sSQL .= "W47_KODAWARI03, ";
// 		$sSQL .= "W47_FREERENT_FLAG, ";
// 		$sSQL .= "W47_HEYAWARI_FLAG, ";
		$sSQL .= "W47_TYUSYAJYO_KOMI, ";
		$sSQL .= "W47_SHIKIKIN_ZERO, ";
		$sSQL .= "W47_REIKIN_ZERO, ";
		$sSQL .= "W47_BAS_RIYOU) ";
		$sSQL .= "VALUES(";
		$sSQL .=  $add_params['InqNo'] . ",";
		$sSQL .=  $add_params['ReqData']['iYachinMin'] . ", ";
		$sSQL .=  $add_params['ReqData']['iYachinMax'] . ", ";
		$sSQL .=  $add_params['ReqData']['iKanrihiFlg'] . ", ";
// 		$sSQL .=  $add_params['ReqData']['iShikireiFlg'] . ", ";
		$sSQL .=  "'" . $add_params['ReqData']['sTatemonoType'] . "', ";
		$sSQL .=  $add_params['ReqData']['iEkitoho'] . ", ";
		$sSQL .=  $add_params['ReqData']['iSenyuMin'] . ", ";
		$sSQL .=  $add_params['ReqData']['iSenyuMax'] . ", ";
		$sSQL .=  "'" . $add_params['ReqData']['sMadori'] . "', ";
		$sSQL .=  $add_params['ReqData']['iChikunensu'] . ", ";
		$sSQL .=  "'" . $add_params['KodawariData']['vKodawari01'] . "', ";
		$sSQL .= "'000', ";
		$sSQL .=  "'" . $add_params['KodawariData']['vKodawari03'] . "', ";
// 		$sSQL .=  $add_params['ReqData']['iFreeRentFlg'] . ", ";
// 		$sSQL .=  $add_params['ReqData']['iHeyaWariFlg'] . ", ";
		$sSQL .=  $add_params['ReqData']['iTyusyajyoKomi'] . ", ";
		$sSQL .=  $add_params['ReqData']['iShikikinZero'] . ", ";
		$sSQL .=  $add_params['ReqData']['iReikinZero'] . ", ";
		$sSQL .=  $add_params['ReqData']['iBasRiyou'] . ") ";
		
		$resArr = $this->dbExecQuery($sSQL, $db_params, $db,"W47REQUEST_KENSAKU_LOG");
		
		return $resArr;
	
	}
	// 20141224 E_Add
}
?>
